import VueRouter from "vue-router";

import home from "./component/tabbar/home.vue";
import vip from "./component/tabbar/vip.vue";
import shopcar from "./component/tabbar/shopcar.vue";
import search from "./component/tabbar/search.vue";
import newslist from "./component/news/NewsList.vue";
import newsinfo from "./component/news/newsInfo.vue";
import photolist from "./component/photo/photolist.vue";
import photoinfo from "./component/photo/photoinfo.vue";
import goodslist from "./component/goods/goodslist.vue";
import goodsinfo from "./component/goods/goodsinfo.vue";
import goodsdesc from "./component/goods/goodsdesc.vue";
import goodscmt from "./component/goods/goodscomments.vue";


var router = new VueRouter({
    routes: [    // 里面不能放空对象被导出  不然导入时会报错
        { path: '/', redirect: '/home'},  // 路由重定向 进入默认首页
        { path: '/home', component: home},
        { path: '/vip', component: vip},
        { path: '/shopcar', component: shopcar},
        { path: '/search', component: search},
        { path: '/home/newslist', component: newslist},
         // 注意如果要传参路由的写法
        { path: '/home/newsinfo/:id', component: newsinfo},
        { path: '/home/photolist', component: photolist},
        { path: '/home/photoinfo/:id', component: photoinfo},
        { path: '/home/goodslist', component: goodslist},
        { path: '/home/goodsinfo/:id', component: goodsinfo, name: 'goodsinfo'},
        { path: '/home/goodsdesc/:id', component: goodsdesc, name: 'goodsdesc' },
        { path: '/home/goodscmt/:id', component: goodscmt, name: 'goodscmt'},
    ],     
    linkActiveClass: 'mui-active'  // 选中时执行的类（覆盖默认的路由高亮的类  默认类为 router-link-active
});

export default router;